import { personalMenuRoutes } from './personal';
import { tabbarRoutes } from './tabbar';

/** @type {import('vue-router').RouteConfig[]} */
export const authorizedRoutes = [
  {
    path: '/',
    name: 'Home',
    redirect: '/message'
  },
  ...tabbarRoutes,
  ...personalMenuRoutes,
  {
    path: '/article/:id',
    component: () => import('@/views/ArticleView.vue')
  },
  {
    path: '/chat/:username',
    name: 'Chat',
    component: () => import('@/views/ChatView.vue'),
    meta: {
      navbarRightPath: ({ route }) => `/group-detail/${route.params.username}`,
      navbarRightText: ({ route }) => route.params.username.startsWith('@TGS') ? '管理' : ''
    }
  },
  {
    path: '/wallet-detail',
    component: () => import('@/views/WalletDetailView.vue'),
    meta: {
      title: '钱包明细'
    }
  },
  {
    path: '/space-publish',
    component: () => import('@/views/SpacePublishView.vue'),
    meta: {
      title: '发布生活圈'
    }
  },
  {
    path: '/notice',
    component: () => import('@/views/NoticeView.vue'),
    meta: {
      title: '公告'
    }
  },
  {
    path: '/change-password',
    component: () => import('@/views/ChangePassword.vue'),
    meta: {
      title: '修改密码'
    }
  },
  {
    path: '/new-friends',
    component: () => import('@/views/NewFriends.vue'),
    meta: {
      title: '新的朋友'
    }
  },
  {
    path: '/group-list',
    component: () => import('@/views/GroupList.vue'),
    meta: {
      title: '我的群聊'
    }
  },
  {
    path: '/add-coin',
    component: () => import('@/views/AddCoinView.vue'),
    meta: {
      title: '链上充币'
    }
  },
  {
    path: '/withdraw-coin',
    component: () => import('@/views/WithdrawCoinView.vue'),
    meta: {
      title: '链上提币'
    }
  },
  {
    path: '/invite-record',
    component: () => import('@/views/InviteRecordView.vue'),
    meta: {
      title: '邀请记录'
    }
  },
  {
    path: '/create-group',
    component: () => import('@/views/CreateGroupView.vue'),
    meta: {
      title: '创建群聊'
    }
  },
  {
    path: '/group-detail/:id',
    component: () => import('@/views/GroupDetailView.vue'),
    meta: {
      title: '群聊管理'
    }
  }
]
